package jobs;

import org.junit.Before;

import models.Organization;
import models.User;
import play.jobs.Job;
import play.jobs.OnApplicationStart;

import play.test.Fixtures;

/**
 * Class that inserts data in the database
 * 
 * @author Heba Khattab
 * 
 */
@OnApplicationStart
public class StartUp extends Job {
	/**
	 * checks that the database is empty and if it is not empty then itcalls
	 * file initial-data.yml that has attributes to be inserted in database
	 * 
	 * @author Heba Khattab
	 */

	public void doJob() {

		// Fixtures.deleteAllModels();
		if (User.count() == 0) {
			Fixtures.loadModels("initial-data.yml");
		}

	}

}
